<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        function number1(callback) {
            setTimeout(function() {
                var num = 1;
                callback(num);
            }, 2000)
        }

        function number2(callback, preNumber) {
            setTimeout(function() {
                callback(preNumber + 1)
            }, 1000)
        }

        function number3(callback, preNumber) {
            setTimeout(function() {
                callback(preNumber + 1)
            }, 3000)
        }

        number1(function(n) {
            number2(function(n2) {
                number3(function(n3) {
                    console.log(n3)
                }, n2)
            }, n)
        })
    </script>
</body>

</html>